Environmental drivers of species diversity in sharks

This document describes how to use rOceans for accessing environmental drivers and link them to spatial patterns of diversity in marine species. Here we show an example for sharks of family Carcharhinidae.

Download rOceans from GitHub and load the package

devtools::install_github("monteroserra/rOceans")
library(rOceans)

First, we need to access the data and compute species diversity

For simplicity, we provide the dataset "Carcharhinidae_total_checked" which is the output obtained using oceanDataCheck() applied to raw datasets from OBIS and GBIF (see vignette 1 with Acropora example for more details on checking and filtering raw data)

data(Carcharhinidae_total_checked)

Carcharhinidae_abundance_5 = oceanAbundance(occurrences = Carcharhinidae_total_checked, cell_size=5)

#Visualize abundance
oceanMaps(Carcharhinidae_abundance_5, logScale=T, main="Carcharhinidae abundance")

Computing species abundance matrix - and several diversity metrics

Carcharhinidae_diversity = oceanDiversity(occurrences = Carcharhinidae_total_checked, print=F)


#Visualize richness
oceanMaps(Carcharhinidae_diversity[[2]], logScale=T, 
          main="Carcharhinidae richness")

Obtaining and using environmental drivers

For raw species richness

Env_sharks_div = oceanEnvironment(biod_grid = Carcharhinidae_diversity[[2]],
                                biodiv_metric = "Species Richness", 
                                plot=T, 
                                log_scale=T)

For corrected species richness

Env_sharks_div_corr = oceanEnvironment(biod_grid = Carcharhinidae_diversity[[3]],
                                biodiv_metric = "Corrected Richness", 
                                plot=T, 
                                log_scale=T)

Regression models

library(ggplot2)

richness = Env_sharks_div
richness_corrected = Env_sharks_div_corr

colnames(richness)[1] <- "S"
colnames(richness_corrected)[1] <- "S"


ggplot(data=richness, aes(x=BO2_tempmean_ss, y=S))  + 
      scale_y_continuous(breaks=c(0,15,30,45,60))+
      xlab("Temperature") + ylab("Richness") +
      geom_point(stroke = 1.1, col="steelblue")+
      geom_smooth(method = "gam", formula = y ~ s(x), col="black") +
      theme_bw()

ggplot(data=richness_corrected, aes(x=BO2_tempmean_ss, y=S))  + 
      xlab("Temperature") + ylab("Corrected Richness") +
      geom_point(stroke = 1.1, col="steelblue")+
      scale_y_continuous(breaks=c(0,15,30,45,60))+
      geom_smooth(method = "gam", formula = y ~ s(x), col="black") +
      theme_bw()

ggplot(data=richness, aes(x=BO_chlomean, y=S))  + 
      xlab("Chlorophile concentration") + ylab("Richness") +
      scale_y_continuous(breaks=c(0,15,30,45,60))+
      geom_point(stroke = 1.1, col="forestgreen")+
      geom_smooth(method = "gam", formula = y ~ s(x), col="black") +
      theme_bw()

ggplot(data=richness_corrected, aes(x=BO_chlomean, y=S))  + 
      xlab("Chlorophile concentration") + ylab("Corrected Richness") +
      geom_point(stroke = 1.1, col="forestgreen")+
      scale_y_continuous(breaks=c(0,15,30,45,60))+
      geom_smooth(method = "gam", formula = y ~ s(x), col="black") +
      theme_bw()
# to see the full list of avilable parameters (326)
env_variables = sdmpredictors::list_layers()
marine_layers = env_variables[env_variables$marine==T, ]

head(marine_layers[,c(1:3)])


monteroserra/rOceans documentation built on Dec. 23, 2024, 2:47 p.m.